<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>支付宝安全支付 - 网上支付 安全快速！</title>
    <link href="/alipay_tf/bootstrap.min.css" rel="stylesheet">
    <link href="/alipay_tf/payguide.css" rel="stylesheet">
    <link href="/alipay_tf/epay_pay.css" rel="stylesheet" media="screen">
    <link href="/alipay_tf/layer.css" rel="stylesheet">


<script>
    (function (doc, win) {
        var docEl = doc.documentElement,
            resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
            recalc = function () {
                var clientWidth = docEl.clientWidth;
                if (!clientWidth)
                    return;
                docEl.style.fontSize = parseInt(100 * ((clientWidth > 750 ? 750 : clientWidth) / 750)) + 'px';
            };
        if (!doc.addEventListener)
            return;
        win.addEventListener(resizeEvt, recalc, false);
        doc.addEventListener('DOMContentLoaded', recalc, false);
    })(document, window);
</script>
    <style>
        .time-item {
            background: orange;
            color: #fff;
            line-height: 25px;
            font-size: 14px;
            font-family: Arial;
            padding: 0 10px;
            margin-right: 10px;
            border-radius: 5px;
            padding: 5px;
            box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.2);
        }

        .left {
            float: left;
            width: 50%;
            height: 100%;
            background-color: #FF6600;
            color: #fff;
            margin: 0;
        }

        .right {
            float: right;
            width: 45%; /*calc(100% - 200px);*/
            height: 100%;
            background-color: #337ab7;
            color: #fff;
            margin: 0;
        }

        .tb {
            /*text-align: left;*/
            margin-bottom: 10px;
            font-size: 18px;
        }

        .tb .cell {
            display: inline-block;
            /*text-align: left;*/
            vertical-align: middle;
            line-height: 26px;
        }

        .tb .cell1 {
            /*width: 75px;
            color: #666;*/
            outline: none;
        }

        .tb .cell2 {
            /*font-weight: bold;*/
        }

        .tb .cell3 {
            /*float: right;*/
        }

        .tb-copy {
            border: 0;
            background-color: #007bff;
            border-radius: 3px;
            color: white;
            outline: none !important;
            padding: 5px 10px;
        }

        .clear-fix {
            clear: both;
        }

        .gray-box {
            height: 1px;
            margin: 10px 0;
        }
        .remainseconds {
            padding: 0 35px 10px 35px;
            height: 87px;
        }
        .remainseconds .time {
            height: 100%;
        }
        .remainseconds .time b {
            font-size: 36px;
        }
        .remainseconds {
            width: 200px;
            margin: 0 auto;
            height: 80px;
            padding: 10px 35px;
            text-align: center;
        }
        .minutes {
            float: left;
        }
        .seconds {
            float: left;
        }
    </style>
    <link rel="stylesheet" href="/alipay_tf/layer(1).css" id="layuicss-layer">
</head>
<body>
<div id="main">
    <div class="header box-flex-column">

        <div class="tb" style="padding: 5px 0 0;">
            <div class="cell cell2">
                <div>￥<span style="font-size: 30px; color: #CD3333;" id="amount">${amount!}</span>元</div>
            </div>
            <div class="cell cell3">
                <button class="tb-copy" id="copymoney" data-clipboard-target="#amount">复制金额</button>
            </div>
        </div>

        <div class="order" style="text-align: left; margin-left: 5%;">

            <font style="font-size:16px; color: #00F; line-height: 25px;">*请勿重复支付！请勿修改金额！</font>
            <br>

        </div>

        <div class="unionbg" id="pc" style="display: none;">
            <div rel="ios" class="pay-main" style="margin-top: 10px;">
                <div class="pay-content">
                    <div id="qrcode" class="qrcode">
                    </div>
                    <div id="timeOut">
                    </div>
                </div>
            </div>

            <div rel="ios" class="pay-hint" style="line-height: 45px; color: #00A0E9; font-weight: bold">打开支付宝【扫一扫】
            </div>
        </div>


        <div style="color: #009900;line-height: 25px; font-size:16px; font-weight: bold; text-shadow: 0 0 4px white, 0 -1px 4px #ff3, 2px -1px 6px #fd3, -2px -1px 11px #f80, 2px -1px 18px #f20;">
            请复制账号向我转账，收款账号：
        </div>

        <div class="copy" style="margin-top: 3px;" id="alipayAccount">${alipayAccount!}</div>
        <div class="copy real_name" style="margin-top: 3px;">${alipayName!}</div>
        <div style="margin: 10px 0px;">
            <button id="copy" class="btn btn-info btn-block btn-lg btn-group-lg" data-clipboard-target="#alipayAccount">
                复制收款账号 并启动支付宝
            </button>
        </div>

        <div class="gray-box"></div>
        <div class="order" style="text-align: left; margin: 0 10%;">
            <div class="tip" style="color: #007bff; font-weight: bold; font-size: 18px;">*转账步骤如下：</div>
            <div class="jiaocheng" style="margin: 5px 0;">
                <img style="max-width: 100%; border: 4px solid #efefef;" src="/alipay_tf/jc3.gif"
                     alt="">
            </div>
            <font style="font-size: 14px; color: #F00; line-height: 25px;"><b>转账步骤1：</b>打开支付宝，点击<span
                    style="color:orange;font-weight: bold;">“转账”</span></font>
            <br>
            <font style="font-size: 14px; color: #F00; line-height: 25px;"><b>转账步骤2：</b>点击<span
                    style="color:orange;font-weight: bold;">“转到支付宝账户”</span></font>
            <br>
            <font style="font-size: 14px; color: #F00; line-height: 25px;"><b>转账步骤3：</b>粘贴已复制的<span
                    style="color:orange;font-weight: bold;">“收款账号”</span></font>
            <br>
            <font style="font-size: 14px; color: #F00; line-height: 25px;"><b>转账步骤4：</b>向该账号转账￥<span
                    style="color:orange; font-size:18px;font-weight: bold;">${amount!}</span>元</font>

        </div>
        <div class="remainseconds">
            <div class="time minutes">
                <b></b>
                <em>分</em>
            </div>
            <div class="time seconds">
                <b></b>
                <em>秒</em>
            </div>
        </div>


    </div>

</div>
<script src="/alipay_tf/jquery.min.js"></script>
<script src="/alipay_tf/clipboard.min.js"></script>
<script src="/alipay_tf/layer.js"></script>
<script src="/alipay_tf/jquery.qrcode.min.js"></script>
<script src="/js/reconnecting-websocket.js"></script>
<script type="text/javascript">
    function getDeviceType() {
        if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {  //判断iPhone|iPad|iPod|iOS
            sid = 'ios';
        } else if (/(Android)/i.test(navigator.userAgent)) {   //判断Android
            sid = 'andorid';
        } else {  //pc
            sid = 'pc';
        };
        return sid;
    }

    var amount = ${amount!};
    var alipayAccount = ${alipayAccount!};
    var alipayName = '${alipayName!}';

    $(function () {
        var str = $(".real_name").html();
        var target = '<span style="font-size:1.5em;color:red;">' + str.substring(0, 1) + "</span>";
        $(".real_name").html(target + str.substr(1));

        //询问框
        //layer.confirm('<div style="font-size:16px;color:#6E7B8B;font-weight:bold;">扫码后，请点击<span style="font-size:18px;color:#CD3333">转账</span>付款<span style="font-size:18px;color:#CD3333">1.00</span>元</div><div style = "font-size:16px;color:#6E7B8B;font-weight: bold;"> 请勿重复支付、请勿修改金额！</div> <div style="font-size:18px;color:red;font-weight:bold;"> 如扫码提示风控，用复制账号转账</div>', {
        layer.confirm('请打开支付宝，向下面的收款账号：<br/><span style="color:red; font-size:18px;">' + alipayAccount + '</span><br/><span style="color:red; font-size:18px;">' + alipayName + '</span><br/>转账￥<span style="color:red; font-size:18px;">' + amount + '</span>元，请勿修改金额！', {
                icon: 1,
                title: '支付提醒',
                btn: ['<font class="copyaa" data-clipboard-text="' + alipayAccount + '" onclick="">复制收款账号</font>'] //按钮
            }, function () {
                var clp = new ClipboardJS('.copyaa');
                clp.on('success', function (e) {
                    e.clearSelection();
                    layer.msg('<div style="font-size: 18px;color:#fff;">收款账号【<span style="color: red; font-size: 28px;">' + alipayAccount + '</span>】复制成功！<br/>启动支付宝【转到支付宝账户】付款！</div>', {time: 2000});
                });
                clp.on('error', function (e) {
                    layer.msg('请手动“点击复制金额”进行复制！');
                });
            }
        );

        //复制
        var clp1 = new ClipboardJS('#copymoney');
        clp1.on('success', function (e) {
            e.clearSelection();
            layer.msg('<div style="font-size:18px;color:#fff;">金额【<span style="color: red; font-size: 28px;">' + amount + '</span>】复制成功！<br/>启动支付宝【转到支付宝账户】付款！</div>', {time: 2000});
        });
        clp1.on('error', function (e) {
            layer.msg('请手动点击“复制金额”进行复制！');
        });


        var clipboard = new ClipboardJS('#copy');
        clipboard.on('success', function (e) {
            //layer.msg('复制成功,请到支付宝中向该账号转账<span style="color:red; font-size:20px;">1.00</span>元,请勿转账其他金额,以免造成损失~');
            //alert('成功复制收款账号【<span style="color:red; font-size:20px;">iabfgsh6876@163.com</span>】,请到支付宝中向该账号转账【￥1.00】元,请勿转账其他金额,以免造成损失~');
            layer.msg('已复制账号【<span style="color:red; font-size:16px;">' + alipayAccount + '</span>】，<br/>请向该账号转账￥<span style="color:red; font-size:16px;">' + amount + '</span>元，请勿修改金额！');
            setTimeout(function () {
                location.href = "alipays://platformapi/startapp?appId=09999988&actionType=toAccount";
            }, 400);
        });
        clipboard.on('error', function (e) {
            alert('浏览器不兼容，请长按账号复制并进行转账');
        });

        $("#copy").click(function () {
            $("#bg").show();
            $("#window1").show();
            $("#window2").hide();
            $("#window3").hide();
            $("#close").show();
            $("#mian").css("height", "100%");
        });
        $("#btn1").click(function () {
            $("#window1").hide();
            $("#window2").show();
            $("#window3").hide();
            $("#close").show();
        });
        $("#btn2").click(function () {
            $("#window1").hide();
            $("#window2").hide();
            $("#window3").show();
            $("#close").show();
        });
        $("#btn3").click(function () {
            $("#bg").hide();
            $("#window1").hide();
            $("#window2").hide();
            $("#window3").hide();
            $("#close").hide();
        });
        $("#close").click(function () {
            $("#bg").hide();
            $("#window1").hide();
            $("#window2").hide();
            $("#window3").hide();
            $("#close").hide();
        });
        if (getDeviceType() == "pc") {
            $("#mobile").hide();
            $("#pc").show();
            var url = window.location.href;
            $('#qrcode').qrcode(url);
            $('#qrcode canvas').width("210px").height("210px").addClass("canvas");
        } else {
            $("#pc").hide();
            $("#mobile").show();
        }
    })


    var timer, minutes, seconds, ci, qi;
    timer = parseInt('${expireTime!}') - 1 ;
    ci = setInterval(function () {
        minutes = parseInt(timer / 60, 10)
        seconds = parseInt(timer % 60, 10);

        minutes = minutes < 10 ? "0" + minutes : minutes;
        seconds = seconds < 10 ? "0" + seconds : seconds;

        $(".minutes b").text(minutes);
        $(".seconds b").text(seconds);
        if (--timer < 0) {
            $(".minutes b").text("00");
            $(".seconds b").text("00");
            $('.qrcode').attr("src","/images/qrcode_timeout.png");
        }
    }, 1000);

    var expireTime = "${expireTime!}";
    console.log(expireTime)
    if(expireTime <= 0) {
        $(".minutes b").text("00");
        $(".seconds b").text("00");
        $('#qrcode').remove();
        $('#timeOut').html("<img src='/images/qrcode_timeout.png'>");
    }else {

    }

    $(function () {
        //WebSocket监听， 等待接收订单支付成功的消息
        if (typeof (WebSocket) != "undefined") {
            //打开监听事件
            var socket = new ReconnectingWebSocket("${wsAddress!}");
            socket.onopen = function () {
            };
            //获得消息事件
            socket.onmessage = function (msgObject) {
                var resDataJSON = JSON.parse(msgObject.data);
                if (resDataJSON.state == '2') { //支付成功
                    layer.alert(
                            '支付成功',
                            {title: '支付提示', icon: 1},
                            function (index) {
                                layer.close(index);
                                AlipayJSBridge.call("exitApp");
                            });
                } else if (resDataJSON.state == '3') { //支付超时
                    layer.alert(
                            '支付超时,请重新下单',
                            {title: '支付提示', icon: 5},
                            function (index) {
                                layer.close(index);
                                AlipayJSBridge.call("exitApp");
                            });
                }
            };
        }
    });
</script>


<div class="layui-layer-shade" id="layui-layer-shade1" times="1"
     style="z-index: 19891014; background-color: rgb(0, 0, 0); opacity: 0.3;"></div>
<div class="layui-layer layui-layer-dialog" id="layui-layer1" type="dialog" times="1" showtime="0" contype="string"
     style="z-index: 19891015; top: 267.5px; left: 57.5px;">
    <div class="layui-layer-title" style="cursor: move;">支付提醒</div>
    <div id="" class="layui-layer-content layui-layer-padding"><i class="layui-layer-ico layui-layer-ico1"></i>请打开支付宝，向下面的收款账号：<br><span
            style="color:red; font-size:18px;">${alipayAccount!}</span><br>转账￥<span
            style="color:red; font-size:18px;">${amount!}</span>元，请勿修改金额！
    </div>
    <span class="layui-layer-setwin"><a class="layui-layer-ico layui-layer-close layui-layer-close1"
                                        href="javascript:;"></a></span>
    <div class="layui-layer-btn layui-layer-btn-"><a class="layui-layer-btn0"><font class="copyaa"
                                                                                    data-clipboard-text="${alipayAccount!}"
                                                                                    onclick="">复制收款账号</font></a></div>
    <span class="layui-layer-resize"></span></div>
<div class="layui-layer-move"></div>
</body>
</html>